<?php
/**
 * Link
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/2/24
 * Time: 5:37
 */
namespace app\admin\model;

use think\Model;
use think\Session;

class Login extends Model //登录
{
    public function login($adminname,$adminpwd)
    {
        $login =db('admin')->where('adminname','=',$adminname)->find();
        if ($login) {
            if ($login['adminpwd'] == md5($adminpwd)) {
                Session::set('id',$login['id']);
                Session::set('adminname',$login['adminname']);
                return 1;
            } else {
                return  2;
            }
        }else{
            return 3;
        }
    }
}